import requests

from common.get_header import get_header

# 新增优惠券
class New_coupon_api(object):
    @classmethod
    def new_coupon(cls, json):
        heaer = get_header()
        resp = requests.post(url="https://testapi.newdjk.cn/chainpharmacies/OrgCoupon/SaveOrgCoupon",
                             headers={"Content-Type": "application/json", "Authorization": heaer},
                             json=json)
        return resp


if __name__ == '__main__':
    data = {"OrgCouponId": 0,
            "OrgCouponName": "优惠0003",
            "CouponQuantity": 2,
            "Denomination": 5,
            "OrderAmountCanUse": 0,
            "OrgId": 0,
            "IsSelectedStore": 0,
            "CouponTimeType": 1,
            "TakedDay": 0,
            "EffectiveDay": 10,
            "StartTime": None,
            "EndTime": None,
            "UseDesc": "我是你你你",
            "CanTakedNum": None,
            "CreateChannel": 2,
            "CreateOrgId": 369,
            "CreateOrgName": "测试单体01",
            "DrId": 0,
            "Stores": [],
            "SendType": "1,2",
            "ShareTitle": "优惠",
            "ShareImg": "https://resource.newdjk.com/Common/202205/2205121552341503530.jpg",
            "ShowShareImg": "https://resource.newdjk.com/Common/202205/2205121552341503530.jpg",
            "CouponType": 2,
            "orderAmounRadio": 0
            }
    resp = New_coupon_api.new_coupon(data)
    print(resp.json())
